/*
 * <h3>Title:wheel-spring-boot-web-starter系统</h3>
 * <p>Copyright (c) 2019, wnfbx@163.com. All rights reserved.</p>
 * @author wnfbx@163.com
 */
package com.wheel.autoconfigure.web.mvc;

import com.wheel.core.utils.Log;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;

/**
 * <dt>Description:WebMvcAutoConfigurationProperties</dt>
 * <dd>mvc 自动配置属性</dd>
 *
 * @author wnfbx@163.com
 * @version 1.0 <i>2019年6月6日 下午2:04:35</i>
 * @since jdk1.7+
 */
@ConfigurationProperties(prefix = "w.spring.mvc")
public class WheelWebMvcProperties {

    /**
     * redirectFor404Page: 404请求跳转地址
     */
    @NestedConfigurationProperty
    private String redirectFor404Page = "";

    /**
     * enableCors: 是否运行跨域
     */
    @NestedConfigurationProperty
    private boolean enableCors;

    /**
     * showExceptionStackTraceMessage: 是否查看系统拦截到的异常堆栈消息
     */
    @NestedConfigurationProperty
    private boolean showExceptionStackTraceMessage = false;

    /**
     * i18n cookies
     */
    @NestedConfigurationProperty
    private CookieProperties i18nCookie;

    public CookieProperties getI18nCookie() {
        return i18nCookie;
    }

    public void setI18nCookie(CookieProperties i18nCookie) {
        this.i18nCookie = i18nCookie;
    }

    public boolean isShowExceptionStackTraceMessage() {
        return showExceptionStackTraceMessage;
    }

    public void setShowExceptionStackTraceMessage(boolean showExceptionStackTraceMessage) {
        this.showExceptionStackTraceMessage = showExceptionStackTraceMessage;
    }

    public String getRedirectFor404Page() {
        return redirectFor404Page;
    }

    public void setRedirectFor404Page(String redirectFor404Page) {
        this.redirectFor404Page = redirectFor404Page;
    }

    public boolean isEnableCors() {
        return enableCors;
    }

    public void setEnableCors(boolean enableCors) {
        this.enableCors = enableCors;
    }

    /*
     * (non-Javadoc)
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return Log.formatMessage("{redirectFor404Page:{},enableCors:{}}", this.getRedirectFor404Page(), this.isEnableCors());
    }
}
